<template>
  <div class="city">
    <city-header></city-header>
    <city-search :list="cities"></city-search>
    <city-chpice :list="hotCities" :cities="cities" :letterci="letterci"></city-chpice>
    <city-nav :list="cities" @alphalett="aplhas"></city-nav>
  </div>
</template>

<script>
import CityHeader from './components/Header.vue'
import CitySearch from './components/Search.vue'
import CityChpice from './components/CityChpice.vue'
import CityNav from './components/NavRight.vue'
import axios from 'axios'
export default {
  name: 'city',
  components: {
    CityHeader,
    CitySearch,
    CityChpice,
    CityNav
  },
  data () {
    return {
      hotCities: [],
      cities: {},
      letterci: ''
    }
  },
  mounted () {
    axios.get('/losaldata/city.json')
      .then((res) => {
        let dataObj = res.data
        let dataList = dataObj.data
        if (dataObj.ret && dataList) {
          this.hotCities = dataList.hotCities
          this.cities = dataList.cities
        }
      })
  },
  methods: {
    aplhas (key) {
      this.letterci = key
    }
  }
}
</script>

<style>
</style>
